<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head lang="en">
		<base th:href="@{/}">
		<meta charset="utf-8" />
		<title>最家</title>
		<link rel="stylesheet" type="text/css" href="css/public.css"/>
		<link rel="stylesheet" type="text/css" href="css/mygxin.css" />
		<link rel="stylesheet" type="text/css" href="before/bootstrap.css"/>
	</head>
	<body>
		<!------------------------------head------------------------------>
		<div class="head ding">
			<div class="wrapper clearfix">
				<div class="clearfix" id="top">
					<h1 class="fl"><a href="index.html"><img src="img/logo.png"/></a></h1>
					<div class="fr clearfix" id="top1">
						<p class="fl">
							<a href="login.html" id="login">登录</a>
							<a href="reg.html" id="reg">注册</a>
						</p>
						<form action="#" method="get" class="fl">
							<input type="text" placeholder="搜索" />
							<input type="button" />
						</form>
						<div class="btn fl clearfix">
							<a href="mygxin.html"><img src="img/grzx.png"/></a>
							<a  class="er1"><img src="img/ewm.png"/></a>
							<a href="cart.html"><img src="img/gwc.png"/></a>
							<p><a ><img src="img/smewm.png"/></a></p>
						</div>
					</div>
				</div>
				<ul class="clearfix" id="bott">
					<li><a href="index.html">首页</a></li>
					<li>
						<a >所有商品</a>
						<div class="sList">
							<div class="wrapper  clearfix">
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav1.jpg"/></dt>
										<dd>浓情欧式</dd>
									</dl>
								</a>
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav2.jpg"/></dt>
										<dd>浪漫美式</dd>
									</dl>
								</a>
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav3.jpg"/></dt>
										<dd>雅致中式</dd>
									</dl>
								</a>
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav6.jpg"/></dt>
										<dd>简约现代</dd>
									</dl>
								</a>
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav7.jpg"/></dt>
										<dd>创意装饰</dd>
									</dl>
								</a>
							</div>
						</div>
					</li>
					<li>
						<a href="flowerDer.html">装饰摆件</a>
						<div class="sList2">
							<div class="clearfix">
								<a href="proList.html">干花花艺</a>
								<a href="vase_proList.html">花瓶花器</a>
							</div>
						</div>
					</li>
					<li>
						<a href="decoration.html">布艺软饰</a>
						<div class="sList2">
							<div class="clearfix">
								<a href="zbproList.html">桌布罩件</a>
								<a href="bzproList.html">抱枕靠垫</a>
							</div>
						</div>
					</li>
					<li><a href="paint.html">墙式壁挂</a></li>
					<li><a href="perfume.html">蜡艺香薰</a></li>
					<li><a href="idea.html">创意家居</a></li>
				</ul>
			</div>
		</div>
		<!------------------------------idea------------------------------>
		<div class="address mt">
			<div class="wrapper clearfix">
				<a href="index.html" class="fl">首页</a>
				<span>/</span>
				<a href="mygxin.html">个人中心</a>
				<span>/</span>
				<a href="addAddress.html" class="on">地址管理</a>
			</div>
		</div>
		
		<!------------------------------Bott------------------------------>
		<div class="Bott">
			<div class="wrapper clearfix">
				<div class="zuo fl">
					<h3>
						<a href="">
							<img id="img" style="width: 61%; height: auto; border-radius: 60px;"/>
						</a>
						<p class="clearfix"><span class="fl">[羊羊羊]</span><span class="fr">[退出登录]</span></p>
					</h3>
					<div>
						<h4>我的交易</h4>
						<ul>
							<li><a th:href="@{/trade/toShopCarPage}">我的购物车</a></li>
							<li><a>我的订单</a></li>
							<li><a th:href="@{/trade/toOrderCommentPage}">评价晒单</a></li>
						</ul>
						<h4>个人中心</h4>
						<ul>
							<li  class="on"><a th:href="@{/user/toMygxin}">我的中心</a></li>
							<li><a th:href="@{/address/toAddress}">地址管理</a></li>
						</ul>
						<h4>账户管理</h4>
						<ul>
							<li><a th:href="@{/user/toMygrxx}">个人信息</a></li>
							<li><a>修改密码</a></li>
						</ul>
					</div>
				</div>
				<div class="you fl">
					<div class="panel-body">
					<table class="table table-striped" style="font-size: medium">
						<h1>收货地址列表
						<a th:href="@{address/toAddAddress}" style="margin-left: 60%;color: #00FFFF"><button style="border-radius: 30px;background-color: #00FFFF">添加收货地址</button></a>
						</h1>
						<thead>
						<tr>
							<th>地址类型</th>
							<th>收货人姓名</th>
							<th>详细地址</th>
							<th>联系电话</th>
							<th colspan="3">操作</th>
						</tr>
						</thead>
						<tbody id="tbody">
						<!--<tr>
							<td>公司</td>
							<td>八戒</td>
							<td>北京市海淀区中关村中路1号1001室</td>
							<td>1380***1234</td>
							<td><a class="btn btn-xs btn-info" ><span class="fa fa-edit"></span> 修改</a></td>
							<td><a class="btn btn-xs add-del btn-info" ><span class="fa fa-trash-o"></span> 删除</a></td>
							<td><a class="btn btn-xs add-def btn-default" >设为默认</a></td>
						</tr>-->
						</tbody>
					</table>
					</div>
				</div>
			</div>
		</div>

		<div class="gotop">
			<a href="cart.html">
			<dl>
				<dt><img src="img/gt1.png"/></dt>
				<dd>去购<br />物车</dd>
			</dl>
			</a>
			<a  class="dh">
			<dl>
				<dt><img src="img/gt2.png"/></dt>
				<dd>联系<br />客服</dd>
			</dl>
			</a>
			<a href="mygxin.html">
			<dl>
				<dt><img src="img/gt3.png"/></dt>
				<dd>个人<br />中心</dd>
			</dl>
			</a>
			<a  class="toptop" style="display: none">
			<dl>
				<dt><img src="img/gt4.png"/></dt>
				<dd>返回<br />顶部</dd>
			</dl>
			</a>
			<p>400-800-8200</p>
		</div>
		
		
		<!--footer-->
		<div class="footer">
			<div class="top">
				<div class="wrapper">
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot1.png"/></a>
						<span class="fl">7天无理由退货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot2.png"/></a>
						<span class="fl">15天免费换货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot3.png"/></a>
						<span class="fl">满599包邮</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot4.png"/></a>
						<span class="fl">手机特色服务</span>
					</div>
				</div>
			</div>
			<p class="dibu">最家家居&copy;2013-2017公司版权所有 京ICP备080100-44备0000111000号<br />
			违法和不良信息举报电话：400-800-8200，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</p>
		</div>
		<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/public.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/user.js" type="text/javascript" charset="utf-8"></script>
	</body>
	<script>
       $(function () {
          $.getJSON("address/getAllAddressInfo",function (data) {
            var addressInfo=data.data;
            if(data.state==200){
              showAddressInfo(addressInfo);
			}
		  })
	   })
      function showAddressInfo(address) {
        for(var i=0;i<address.length;i++){
			var tr= '<tr>'+
					'<td>'+address[i].addressType+'</td>'
					+'<td>'+address[i].recevier+'</td>'
					+'<td>'+address[i].detail+'</td>'
					+'<td>'+address[i].phone+'</td>'
					+'<td><a class="btn btn-xs btn-info" href="address/toUpdateAddress?addId='+address[i].addId+'"><span class="fa fa-edit"></span> 修改</a></td>'
					+'<td><a class="btn btn-xs add-del btn-info" onclick="deleteAddress('+address[i].addId+')" ><span class="fa fa-trash-o"></span> 删除</a></td>'
					+'<td><a class="btn btn-xs add-def btn-default"  onclick="setDefault('+address[i].addId+')">设为默认</a></td>'
					+'</tr>';
            $("#tbody").append(tr);
		}
		  //地址信息显示时 显示默认地址
		  $(".add-def:eq(0)").hide();
	  }
	   function setDefault(addId) {
		   var url ="address/setDefault";
		   var param={"addId":addId};
		   $.post(url,param,function (data) {
			   if(data.state==200){
				   alert(data.message);
				   location.reload();
			   }else{
				   alert(data.message);
			   }
		   })
	   }
	   function deleteAddress(addId) {
		   var url ="address/deleteAddress";
		   var param={"addId":addId};
		   $.post(url,param,function (data) {
			   if(data.state==200){
				   alert(data.message);
				   location.reload();
			   }else{
				   alert(data.message);
			   }
		   })
	   }
	   $(function () {
		   var imagePath= $.cookie("image");
		   //给img赋值
		   $("#img").attr("src",imagePath);
	   })
	</script>
</html>
